<?php
class Adv_listWidget extends BaseWidget{
	/**
	 * 显示前获取需要显示的数据
	 */
	public function get_data(){
		$id = $this->config['id'];
		if(isset($this->config['limit'])){
			$limit = $this->config['limit'];
		}else{
			$limit = 4;
		}
		$mod = new AdModel();
		$ads = $mod->find(array('site_id'=>SITE_ID, 'code'=>$id), null, 0, $limit);
		if(!empty($ads)){
			$keys = array_keys($ads);
			$ads = $ads[$keys[0]];
		}
		return array('ads' => $ads);
	}
	
	/**
	 * 配置时处理Post数据
	 * @param $data 封装Post数据的数组
	 */	
	public function get_post_data(&$data){
		//$data['name'] = trim($_POST['name']);
		
	}
}
?>